﻿<?php
// session_start();
	
	if (!isset($_SESSION["taikhoan"]))
	{
		header("Location: ad-dangnhap.php");
	}
	 include "connect.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

		<!--form thêm mới sinh viên -->
	<form name="f" method="post" action="" onsubmit="">
			<table width="500" align="center" border="0" style="border:1px solid #0066FF" cellspacing="0">
						
					  <tr> 
							<td height="30" colspan="2" align="center" bordercolor="#FFFFFF" background="image/bg_header.gif">
								<span style="font-size:24px; color:#FFFFFF; font-weight:bold;">Thêm Giảng Viên</span></td>
					  </tr>
					
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="15"  colspan="2"></td>
						 
					  </tr> 
						
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Mã Số Giảng Viên:</td>
						 <td align="left"><input type="text" name="msgv" /></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Họ Tên Giảng Viên:</td>
						 <td align="left"><input type="text" name="tengv" /></td>
					  </tr>
					  
					 <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Giới Tính Giảng Viên:</td>
						 <td align="left"><input type="radio" name="gtgv" value="1" checked="checked" /> Nam &nbsp;&nbsp;<input type="radio" name="gtgv" value="0" /> Nữ </td>
					  </tr> 
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Năm Sinh Giảng Viên:</td>
						 <td align="left"><input type="text" name="nsgv" size="4" /></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Email Giảng Viên:</td>
						 <td align="left"><input type="text" name="emgv" /></td>
					  </tr>
					  
					   <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Bộ Môn Giảng Viên:</td>
						 <td align="left"><input type="text" name="mabm" /></td>
					  </tr>
					  
					   <tr bordercolor="#FFFFFF" align="left"> 
						  <td  height="30" colspan="2" class="style4">Tài Khoản:</td>
					  </tr>
					  
					   <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Mật Khẩu:</td>
						 <td align="left"><input type="password" name="mkgv" /></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="15"  colspan="2"></td>
						 
					  </tr> 
					  
					  <tr bordercolor="#FFFFFF">
						  <td  align="right" height="30"><input type="submit" value="Lưu Lại" name="luu" /></td>
						  <td align="center"><input type="reset" value="Làm Lại" name="huy" /></td>
					 </tr>
					
			</table>
</form>	
<?php
           if (isset($_POST["luu"]))
				{
				          $ms = $_POST["msgv"];
				          $ht = $_POST["tengv"];
						  $gt = $_POST["gtgv"];
						  $ns = $_POST["nsgv"];
						  $em = $_POST["emgv"];
						  $mbm = $_POST["mabm"];
						  $mk = $_POST["mkgv"];
						  $mkmh = md5($mk);
						  
						  $kq = mysql_query(" insert into `giang vien` values('$ms','$ht','$em','$ns','$gt','$ms','$mbm' )");
						  $kq1 = mysql_query(" insert into `tai khoan` values('$ms','$mkmh','GV' )");
						  
						  echo "<script type='text/javascript'>alert('Them Thanh Cong')</script>";
		                  echo '<meta http-equiv="refresh" content="0;URL=ad-trangchu.php?nav=cngv">';
						  
				}
 ?>	
</body>
</html>

